package asteroids;

import be.kuleuven.cs.som.annotate.*;

@Value
public final class Position {
	/**
	 * 
	 * @param x
	 *            The value of the X-coordinate, expressed in km. *
	 * @param y
	 *            The value of the X-coordinate, expressed in km.
	 * 
	 * @post The X-coordinate of this new position is equal to the given x.
	 *       |(new this).getX() == x
	 * @post The Y-coordinate of this new position is equal to the given y.
	 *       |(new this).getY() == y
	 * @throws IllegalArgumentException
	 *             The coordinates aren't numbers | Double.isNaN(x) ||
	 *             Double.isNaN(y)
	 * @invar The x-coordinate equals x | getX() == x
	 * @invar The y-coordinate equals y |getY() == y
	 */

	public Position(double x, double y) throws IllegalArgumentException {
		if (Double.isNaN(x) || Double.isNaN(y)) {
			throw new IllegalArgumentException();
		}
		this.X = x;
		this.Y = y;
	}

	private final double X;
	private final double Y;

	/**
	 * 
	 * @return The X-coordinate, expressed in km | result == this.X
	 */
	@Immutable
	@Basic
	public double getX() {
		return this.X;
	}

	/**
	 * 
	 * @return The Y-coordinate, expressed in km | result == this.Y
	 */
	@Immutable
	@Basic
	public double getY() {
		return this.Y;
	}

}
